package com.suning.sawp.service.impl.model;


import javax.annotation.Resource;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.suning.rsc.dto.responsedto.MbfServiceResponse;
import com.suning.rsc.mqservice.ei.annotation.EsbEIServerService;
import com.suning.rsc.server.NullResponseDto;
import com.suning.rsc.server.mq.MQServerServiceHandler;
import com.suning.sawp.constants.LoggerConstants;
import com.suning.sawp.dto.common.NsfNullReponseInterfaceForEsb;
import com.suning.sawp.intf.model.ModelManageService;
import com.suning.sawp.intf.model.PrintPriceTagBean;
/**
 * 
 * 接收价签系统过来的价签商品数据<br> 
 * 〈功能详细描述〉
 * PrintPriceDetail-sendPrintPriceTagDetails
 * @author 12061818
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@EsbEIServerService(connectionFactory = "snsawpConnectionFactoryAdapter", receiveQueue = "recPirceTagQueue")
public class RecPrintPriceTagListener extends MQServerServiceHandler<PrintPriceTagBean, NullResponseDto, NsfNullReponseInterfaceForEsb>{

    private static final Logger LOGGER = LoggerFactory.getLogger(LoggerConstants.SAWP_INTEGRATION);
    
    @Resource
    ModelManageService modelManageService;
    
    @Override
    public NullResponseDto handleBizz(PrintPriceTagBean response, String uid) {
        LOGGER.info("RecPrintPriceTagListener handleBizz:{},uid:{}",response,uid);
        try{
            if(response != null && StringUtils.isNotBlank(response.getStoreCode()) && CollectionUtils.isNotEmpty(response.getList())){
                modelManageService.saveModelList(response.getStoreCode(), response.getList());
            }
        }catch(Exception e){
            LOGGER.error("RecPrintPriceTagListener handleBizz",e);
        }
        return null;
    }

    @Override
    public void sendResponse(NsfNullReponseInterfaceForEsb clientInterface,
            NullResponseDto response, MbfServiceResponse serviceResponse) {
      
        
    }

}
